package com.it.sun.yuebike.framework.config;

import cn.dev33.satoken.exception.NotLoginException;
import com.it.sun.yuebike.framework.constant.ResponseCode;
import com.it.sun.yuebike.framework.constant.ResponseMsg;
import com.it.sun.yuebike.framework.model.dto.Result;
import com.it.sun.yuebike.framework.util.ResultUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @ClassName com.it.sun.yuebike.framework.config.GlobalExceptionHandler
 * @Author sunmannian
 * @Date 2021/5/31 14:20
 * @Version V1.0
 * Description  <全局异常处理器>
 * Copyright (C) 北京中电兴发科技有限公司  since 2021/5/31
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(NotLoginException.class)
    public Result notLoginException() {
        return ResultUtils.error(ResponseCode.NOT_LOGIN, ResponseMsg.NOT_LOGIN);
    }
}



